﻿using B.S.Packaged.Domain;
using B.S.Packaged.ErrorCode;
using B.S.Packaged.WebAPI.Read.Application.Command.ReportCommand;
using MediatR;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Packaged.WebAPI.Read.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ReportController : ControllerBase
    {
        private readonly IMediator mediator;

        public ReportController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 查询报工信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<List<Report>>> QueryReport([FromQuery] QueryReportCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 反填信息成功
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<Report>>> ShowReport([FromQuery] ShowReportCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
